STEP 17: Why is the while loop not infinite? Let's take a closer look at that using the error and r test case.

The while loop is not infinite because we change each r in error by capitalizing it with .upper()! Each time the loop runs, it finds one r and changes it to R. Eventually, all of the r's become R's. For a conditional, r is NOT the same as R. Eventually r is no longer in the word eRRoR, which causes the loop to stop!

  • Enter this code as the last line in the while loop: print(word_list) View the output in the Console!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)